AR Services Manager Library 1.0

With this library you will be able to manage services in a NT system.

 

History:

 

The classes included in this library are:

clsServices
This class can be used to list and access services in a system. You can specify what type of services to want to have listed.
Properties:
  • ComputerName as String. By default, this property is set to the name of the computer in which the library is running. You can specify the name of another computer to access the services running there.
  • Count as Long. Number of services listed.
  • Item (Index) as clsService. This property will take you to a clsService object that contains the properties and the methods to access the service specified. You can specify a service by putting the number that is has in the collection or by passing its name.
  • ServicesEnumState as enServiceEnumState. The possible values for this property are: Active Services, Both Active and Inactive Services or Inactive Services. Specify here what type of services you want to list. The library will update itself if this property is changed.
  • ServicesEnumType as enServiceEnumType. The possible values for this property are: WIN32 Services, Kernel and File System Drivers or Both WIN32 and Drivers. Specify here what type of services you want to have listed. The library will update itself if this property is changed.
Methods:
  • Delete (Index) as Boolean. Pass the number that a service has in the collection or the name of a service to delete it. The method returns True if successful or False if there was an error. After you delete a service, it is not inmediatelly removed from the services, if it has references to it. If you try to call the function again after you got True (successful), the method will return False.
  • Refresh as Boolean. Call this method to refresh the contents of the object. Returns True if successful or False if there was an error.

 

clsService
This class is returned by the clsServices class (one per service listed), but you can also use it independently to access a specific system, in the local machine or through a network. To access a specific service, just set the name or the display name of the service you want to access. The class will update itself automatically with the information of the service. Using this class you can also start, stop, pause or continue services.
Properties:
  • BinaryPathName. Path to the binary file of the service.
  • CheckPoint as Long.
  • ComputerName as String. By default, this property is empty if you are using this class independently, or has the same value as the class clsServices is this class is an item of the other. You can specify another name to access a service in another computer.
  • ControlsAccepted as enControlsAccepted. Possible values are: Accept Pause & Continue, Accept Shutdown or Accept Stop. Also, it could be any combination of these values. To know if a service accepts a certain control, use this expression: CBool ( Svc.ControlsAccepted And Accept Stop). If the expression returns True, then the service accepts the control Stop.
  • CurrentState as enServiceStatus. Possible values are: Continue Pending, Pause Pending, Paused, Running, Start Pending, Stop Pending or Stopped. You can also set this property to Start, Stop or Pause to modify the state of the service.
  • Dependencies as clsSVCDependencies. This property will return an object that contains the dependecies of the service, if any.
  • DisplayName as String. Display name for the service (those you can see in the services control manager).
  • LoadOrderGroup as String.
  • Name as String. Internal name of the service.
  • ServiceSpecificExitCode as Long.
  • ServiceType as enServiceType. Possible values are: File System Driver, Kernel Driver, WIN32 Own Process, WIN32 Share Process, Interactive WIN32 Own Process or Interactive WIN32 Share Process.
  • StartErrorSeverity as enStartErrorSeverity. Possible values are: Ignore Error, Normal Error, Severe Error ore Critical Error. Informs on how there server will act if an error ocurres at startup.
  • StartName. Depending on the type of service, this can be the name of the account under which the service is running.
  • StartType as enStartType. Possible values are: Auto Start, Boot Start, Demand Start, Disabled, System Start. Indicates how the service is started.
  • TagID as Long.
  • WaitHint as Long.
  • Win32ExitCode as Long.
Methods:
  • ContinueService as Boolean. Use this method to continue the service if it is paused. Returns True of successful or False if an error ocurred.
  • PauseService as Boolean.Use this method to pause a service if it is running. Returns True of successful or False if an error ocurred.
  • StartService as Boolean. Use this method to start a service if it is stopped. Returns True of successful or False if an error ocurred.
  • StopService as Boolean. Use this method to stop a service if it is running. Returns True of successful or False if an error ocurred.
  • Refresh. Forces the library to update the information about the service. Returns True of successful or False if an error ocurred.

 

clsSVCDependencies
This object is used to manage dependencies of the services.
Properties:
  • Count as Long. Number of dependencies being listed.
  • Item (lIndex as Long) as String. Pass a number and this property returns the dependency that has that number in the collection.
  • Source as String. This property returns a char 0 divided string with the dependecies. This is how they are originally given by the system.
Method:
  • Add (strCad as String). Use this method to add a dependency to the service. Note: Obviously, this method shouldn't be used when services are being listed, although anyways that wouldn't affect anything. The only reason for this method to exist is because it will be necessary when the capacity to create services is added to the library.
  • Remove (lIndex as Long) as Boolean. Use this method to remove dependencies to the service. Note: same as method Add.

 

Alvaro Redondo, 1998. All Rights Reserved.
http://www.sevillaonline.com/ActiveX